package com.rd.student.jiaji.class2.huangyiming.Day0808;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Students {
    public static void main(String[] args) {
        try {
            BufferedWriter writer = new BufferedWriter(new FileWriter("Student.txt"));
            Scanner scanner = new Scanner(System.in);

            for (int i = 0; i <= 2; i++) {
                System.out.println("输入第" + i + "个的信息");
                System.out.println("姓名");
                String name = scanner.next();
                System.out.println("语文成绩");
                int Chinese = scanner.nextInt();
                System.out.println("数学成绩");
                int math = scanner.nextInt();

                int zong = Chinese + math;

                writer.write("姓名" + name + ",语文" + Chinese + ",数学" + math + ",总分" + zong);
                writer.newLine();
            }
            writer.close();
            System.out.println("已完成");
        } catch (IOException e) {
            System.out.println("" + e.getMessage());
        }
    }

}
